#pragma once
#ifndef RESOURCE_MANAGER_H
#define RESOURCE_MANAGER_H

#include <map>
#include <string>


template<typename R>   //R is the class representation of the resource being managed
class ResourceManager
{
private:
	std::map<std::string, R*> m_resourceMap;
	std::string m_resourceName;   //name for the resource used in XML file (e.g. "image" for SDL_Surface)
	R* (*m_getResource) (const char*);   // function pointer takes in path to resource and returns pointer to it
	void (*m_deleteResource) (R*);   //function pointer that deletes resource
	
public:
	ResourceManager(
		R* (*getResource) (const char*), 
		void(*deleteResource) (R*),
		std::string resourceName
		);
	bool loadResources();
	void deleteResources();
	R* get(std::string id) const;
};

#endif //RESOURCE_MANAGER_H
